home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 4
/
Aminet 4 - November 1994.iso
/
aminet
/
comm
/
term
/
term41source.lha
/
Extras
/
Source
/
term-Source.lha
/
ClipPanel.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-07-30
|
6KB
|
289 lines
/*
** ClipPanel.c
**
** Editing panel for clipboard configuration
**
** Copyright © 1990-1994 by Olaf `Olsen' Barthel
** All Rights Reserved
*/
#include "termGlobal.h"
enum { GAD_UNIT=1000,GAD_USE,GAD_CANCEL,GAD_DEFAULT };
STATIC STRPTR __saveds
ShowTime(struct Gadget *SomeGadget,WORD Level)
{
return(LocaleSeconds(Level));
}
BYTE __regargs
ClipPanel(struct Configuration *Config,BYTE *Default)
{
struct LayoutHandle *Handle;
BYTE Cancel = FALSE;
SaveConfig(Config,PrivateConfig);
if(Handle = LT_CreateHandleTags(Window -> WScreen,
LH_LocaleHook, &LocaleHook,
TAG_DONE))
{
struct Window *PanelWindow;
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, VERTICAL_KIND,
LA_LabelID, MSG_V36_0019,
TAG_DONE);
{
LT_New(Handle,
LA_Type, INTEGER_KIND,
LA_LabelID, MSG_CLIPPANEL_UNIT_GAD,
LA_WORD, &Config -> ClipConfig -> ClipboardUnit,
LA_Chars, 20,
LAIN_Min, 0,
LAIN_Max, 255,
LA_ID, GAD_UNIT,
LAIN_UseIncrementers, TRUE,
GTIN_MaxChars, 3,
TAG_DONE);
LT_New(Handle,
LA_Type, STRING_KIND,
LA_LabelID, MSG_CLIPPANEL_PASTE_PREFIX_GAD,
LA_STRPTR, Config -> ClipConfig -> InsertPrefix,
GTST_MaxChars, 79,
TAG_DONE);
LT_New(Handle,
LA_Type, STRING_KIND,
LA_LabelID, MSG_CLIPPANEL_PASTE_SUFFIX_GAD,
LA_STRPTR, Config -> ClipConfig -> InsertSuffix,
GTST_MaxChars, 79,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type, VERTICAL_KIND,
LA_LabelID, MSG_V36_0020,
TAG_DONE);
{
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, CYCLE_KIND,
LA_LabelID, MSG_CLIPPANEL_TEXT_PACING_GAD,
LA_UBYTE, &Config -> ClipConfig -> PacingMode,
LACY_FirstLabel,MSG_CLIPPANEL_DIRECT_TXT,
LACY_LastLabel, MSG_CLIPPANEL_KEYDELAY_TXT,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type, VERTICAL_KIND,
LA_LabelID, MSG_V36_0021,
TAG_DONE);
{
LT_New(Handle,
LA_Type, SLIDER_KIND,
LA_LabelID, MSG_CLIPPANEL_CHAR_DELAY_GAD,
GTSL_Min, 0,
GTSL_Max, 10 * 100,
LA_Chars, 10,
LA_WORD, &Config -> ClipConfig -> CharDelay,
GTSL_LevelFormat, "%s s",
GTSL_DispFunc, ShowTime,
TAG_DONE);
LT_New(Handle,
LA_Type, SLIDER_KIND,
LA_LabelID, MSG_CLIPPANEL_LINE_DELAY_GAD,
GTSL_Min, 0,
GTSL_Max, 10 * 100,
LA_Chars, 10,
LA_WORD, &Config -> ClipConfig -> LineDelay,
GTSL_LevelFormat, "%s s",
GTSL_DispFunc, ShowTime,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type, VERTICAL_KIND,
LA_LabelID, MSG_V36_0024,
TAG_DONE);
{
LT_New(Handle,
LA_Type, STRING_KIND,
LA_LabelID, MSG_CLIPPANEL_LINE_PROMPT_GAD,
LA_STRPTR, Config -> ClipConfig -> LinePrompt,
LA_Chars, 10,
GTST_MaxChars, 255,
TAG_DONE);
LT_New(Handle,
LA_Type, SLIDER_KIND,
LA_LabelID, MSG_CLIPPANEL_SEND_TIMEOUT_GAD,
GTSL_Min, 0,
GTSL_Max, 10 * 100,
LA_WORD, &Config -> ClipConfig -> SendTimeout,
GTSL_LevelFormat, "%s s",
GTSL_DispFunc, ShowTime,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type,VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, XBAR_KIND,
LAXB_FullSize, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,LA_Type,HORIZONTAL_KIND,
LAGR_SameSize, TRUE,
LAGR_Spread, TRUE,
TAG_DONE);
{
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_GLOBAL_USE_GAD,
LA_ID, GAD_USE,
LABT_ReturnKey, TRUE,
LABT_ExtraFat, TRUE,
TAG_DONE);
if(Default)
{
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_GLOBAL_DEFAULT_GAD,
LA_ID, GAD_DEFAULT,
LABT_ExtraFat, TRUE,
TAG_DONE);
}
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_GLOBAL_CANCEL_GAD,
LA_ID, GAD_CANCEL,
LABT_EscKey, TRUE,
LABT_ExtraFat, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_EndGroup(Handle);
}
if(PanelWindow = LT_Layout(Handle,LocaleString(MSG_CLIPPANEL_CLIP_SETTINGS_TXT),NULL,0,0,IDCMP_CLOSEWINDOW,0,
LAWN_HelpHook, &GuideHook,
LAWN_Parent, Window,
WA_DepthGadget, TRUE,
WA_CloseGadget, TRUE,
WA_DragBar, TRUE,
WA_RMBTrap, TRUE,
WA_Activate, TRUE,
TAG_DONE))
{
struct IntuiMessage *Message;
BOOLEAN Done = FALSE;
ULONG MsgClass,
MsgQualifier;
UWORD MsgCode;
struct Gadget *MsgGadget;
GuideContext(CONTEXT_CLIP);
PushWindow(PanelWindow);
LT_ShowWindow(Handle,TRUE);
do
{
if(Wait(PORTMASK(PanelWindow -> UserPort) | SIG_BREAK) & SIG_BREAK)
{
SaveConfig(PrivateConfig,Config);
break;
}
while(Message = (struct IntuiMessage *)GT_GetIMsg(PanelWindow -> UserPort))
{
MsgClass = Message -> Class;
MsgQualifier = Message -> Qualifier;
MsgCode = Message -> Code;
MsgGadget = (struct Gadget *)Message -> IAddress;
GT_ReplyIMsg(Message);
LT_HandleInput(Handle,MsgQualifier,&MsgClass,&MsgCode,&MsgGadget);
if(MsgClass == IDCMP_CLOSEWINDOW)
{
SaveConfig(PrivateConfig,Config);
Done = TRUE;
}
if(MsgClass == IDCMP_GADGETUP)
{
switch(MsgGadget -> GadgetID)
{
case GAD_USE:
Done = TRUE;
break;
case GAD_CANCEL:
SaveConfig(PrivateConfig,Config);
Cancel = Done = TRUE;
break;
case GAD_DEFAULT:
*Default = TRUE;
Done = TRUE;
break;
}
}
}
}
while(!Done);
PopWindow();
}
LT_DeleteHandle(Handle);
}
if(Default)
return((BYTE)(!Cancel));
else
return((BYTE)memcmp(PrivateConfig -> ClipConfig,Config -> ClipConfig,sizeof(struct ClipSettings)));
}